--[[
local CardsValue = {
    3,3,3,3,
    4,4,4,4,
    5,5,5,5,
    6,6,6,6,
    7,7,7,7,
    8,8,8,8,
    9,9,9,9,
    10,10,10,10,
    11,11,11,11,    -- J
    12,12,12,12,    -- Q
    13,13,13,13,    -- K
    14,14,14,       -- A
    15,             -- 2
}
--]]

local config = {
	istest = false,
	use = 4,	-- 使用下面哪一个配置
	cards = {	-- 配置的值对应上面CardsValue的内容
		[1] = {
			mode = 1,	-- 16张
			value = {	-- 牌型
			   10, 10, 10, 10,  9,  9,  9,  9,  5,  5,  5,  5,  6,  6,  6,  6,	-- 座位1将获得的手牌
			    4,  7,  7,  7,  7,  8,  8,  8,  8,  4,  4,  4, 14, 14, 14, 15,	-- 座位2将获得的手牌
			    3,  3,  3,  3, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 	-- 座位3将获得的手牌
			},
		},
		[2] = {
			mode = 2,	-- 15张
			value = {	-- 牌型
				11,  3,  3,  3,  9,  7,  9,  9,  5,  5,  5,  4,  6,  6,  6,		-- 座位1将获得的手牌
				 6,  7,  7,  7,  9,  8,  8,  8,  8,  4,  5,  4,  4, 10, 10, 		-- 座位2将获得的手牌
			    10, 10, 11, 11, 11,  3, 12, 12, 12, 12, 13, 13, 13, 14, 15,		-- 座位3将获得的手牌
			},
		},
		[3] = {
			mode = 1,	-- 16张
			value = {	-- 牌型
				14,  4,  5,  6,  7,  8,  9,  10,  11,  12,  13,  13,  13,  13,  14,  15,	-- 座位1将获得的手牌
			   3,  3,  3,  3,  7,  7,  8,  8,  9,  9,  10,  10,  11, 11, 4, 14,	-- 座位2将获得的手牌
			   4, 4, 5, 5, 5, 6, 6, 6, 7, 8, 9, 10, 11, 12, 12, 12,	-- 座位3将获得的手牌
			},
		},
		[4] = {
			mode = 1,	-- 16张
			value = {	-- 牌型
				14,  4,  5,  6,  7,  8,  9,  10,  11,  12,  12,  13,  13,  13,  14,  15,	-- 座位1将获得的手牌
			   3,  3,  3,  3,  7,  7,  8,  8,  9,  9,  10,  10,  11, 11, 4, 14,	-- 座位2将获得的手牌
			   4, 4, 5, 5, 5, 6, 6, 6, 7, 8, 9, 10, 11, 12, 12, 13,	-- 座位3将获得的手牌
			},
		},
		[5] = {
			mode = 1,	-- 16张
			value = {	-- 牌型
			   3,  3,  3,  7,  4,  4,  4,  9,  5,  5,  5,  6,  6,  6,  14, 15,	-- 座位1将获得的手牌
			   4,  7,  7,  7,  3,  8,  8,  8, 11,  9,  9,  9,  12, 10, 10, 10,	-- 座位2将获得的手牌
			   5, 11, 12, 13, 6, 8, 12, 10, 11, 13, 13, 13, 11, 14, 14, 12,	-- 座位3将获得的手牌
			},
		},
		[6] = {
			mode = 1,	-- 16张
			value = {	-- 牌型
				3,  3,  4,  4,  5,  5,  6,  6,  11,  12,  13,  14,  15,  11,  10,  8,	-- 座位1将获得的手牌
			   3,  4,  4,  5,  5,  6,  6,  7,  7,  8,  9,  9,  12, 10, 12, 11,	-- 座位2将获得的手牌
			   3, 7, 7, 8, 8, 9, 9, 10, 10, 13, 13, 13, 11, 14, 14, 12,	-- 座位3将获得的手牌
			},
		},
		[7] = {
			mode = 1,	-- 16张
			value = {	-- 牌型
			  15, 13, 13, 11, 11, 11, 10,  8,  8,  7,  6,  6,  4,  4,  3,  3,		-- 座位1将获得的手牌
			  14, 14, 13, 12, 12, 12, 11, 10, 10, 10,  9,  9,  7,  5,  5,  5,		-- 座位2将获得的手牌
			  14,  7, 13, 12,  9,  9,  8,  8,  7,  5,  6,  6,  4,  4,  3,  3,		-- 座位3将获得的手牌
			},
		},
		[8] = {
			mode = 1,	-- 16张
			value = {	-- 牌型
				3,  4,  5,  6,  7,  8,  9,  10,  11,  12,  13,  13,  13,  13,  14,  15,	-- 座位1将获得的手牌
			   3,  3,  4,  5,  5,  6,  7,  7,  10,  8,  9,  3,  12, 9, 12, 11,	-- 座位2将获得的手牌
			   4, 4, 5, 6, 6, 7, 9, 10, 10, 8, 11, 8, 11, 14, 14, 12,	-- 座位3将获得的手牌
			},
		},
	},
}

local function check_config()
	if not config.istest then return end
	local conf = config.cards[config.use]
	if conf.mode == 1 and #conf.value ~= 48 then
		print("config error: cards total number is illegal!")
		return
	end
	if conf.mode == 2 and #conf.value ~= 45 then
		print("config error: cards total number is illegal!")
		return
	end
	local temp = {}
	for k, v in ipairs(conf.value) do
		if v < 1 or v > 15 then
			print("config error: value out of range!")
			return
		end
		if temp[v] then
			temp[v] = temp[v] + 1
		else
			temp[v] = 1
		end
	end
	for k, v in pairs(temp) do
		if conf.mode == 1 then
			if k <= 13 then
				if v ~= 4 then
					print("config error1: cards number is not 4!")
					return
				end
			elseif k == 14 then
				if v ~= 3 then
					print("config error1: cards number is not 3!")
					return
				end
			elseif k == 15 then
				if v ~= 1 then
					print("config error1: cards number is not 1!")
					return
				end
			end
		elseif conf.mode == 2 then
			if k <= 12 then
				if v ~= 4 then
					print("config error2: card number is not 4!")
					return
				end
			elseif k == 13 then
				if v ~= 3 then
					print("config error2: card number is not 3!")
					return
				end
			elseif k == 14 then
				if v ~= 1 then
					print("config error2: card number is not 1!")
					return
				end
			elseif k == 15 then
				if v ~= 1 then
					print("config error2: card number is not 1!")
					return
				end
			end
		end
	end
	print("config check succeed!")
end

check_config()

return config
